package ToYesterday.Day01;

import java.util.ArrayList;
import java.util.Locale;

public class validPalindrome {
    public static void main(String[] args) {
        String s1 = "A man, a plan, a canal: Panama";
        String s2 = "race a car";
        s1 = s1.toLowerCase(Locale.ROOT);
        s1.toCharArray();
        ArrayList<Character> list = new ArrayList();
        int i = 0;
//        for (int i = 0; i<s1.length();i++){
//            for (int j = s1.length()-1;j>i;j--){
        int countf=0,countl=s1.length()-1;
        char first='d', last='d';
        while (countf<countl) {
            if (s1.charAt(countf) >= 'a' && s1.charAt(countf) <= 'z') {
                first = s1.charAt(i);
                System.out.println(first);
            } else {
                countf++;
                continue;
            }
            if (s1.charAt(countl) >= 'A' && s1.charAt(countl) <= 'z') {
                last = s1.charAt(countl);
            } else {
                countl--;
                continue;
            }
            if (first == last) {
                list.add(first);
                countf++;
                countl--;
            }

//            }
//        }
        }
        for (char a:list){
            System.out.println(a);
        }

    }
}
